package com.itheima.service.impl;

import com.itheima.dao.ScoreDao;
import com.itheima.pojo.Score;
import com.itheima.service.ScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Administrator
 * @TIME 2020/7/9 2:01
 * @description
 */
@Service
public class ScoreServiceImpl implements ScoreService {
    @Autowired
    private ScoreDao scoreDao;
    @Override
    //@Transactional(propagation = Propagation.NESTED)
    public void update(Score score) {
        Score byId = scoreDao.findById(score.getId());
        if (byId!=null){
            scoreDao.update(score);
        }else {
            scoreDao.save(score);
        }
        int i=5/0;
    }
}
